package dcc.service;

import dcc.model.SocialWorkInfo;
import dcc.persistence.SocialWorkMapper;

public class SocialWorkService extends BaseService {

	private SocialWorkMapper socialWorkMapper;

	public void setSocialWorkMapper(SocialWorkMapper socialWorkMapper) {
		this.socialWorkMapper = socialWorkMapper;
	}

	public SocialWorkService() {
		super(SocialWorkService.class);
	}

	public void save(SocialWorkInfo socialWorkInfo) {
		if (socialWorkInfo.getId() == 0) {
			insert(socialWorkInfo);
		} else {
			update(socialWorkInfo);
		}
	}

	private void insert(SocialWorkInfo socialWorkInfo) {
		socialWorkMapper.insert(socialWorkInfo);
	}

	private void update(SocialWorkInfo socialWorkInfo) {
		socialWorkMapper.update(socialWorkInfo);
	}

	public SocialWorkInfo getSocialWorkInfoByBaseId(
			int baseId) {
		return socialWorkMapper.getSocialWorkInfoByBaseId(baseId);
	}
}
